<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    login <br>
    账号：<input type="text" id="user"> <br>
    密码：<input type="text" id="pass"> <br>
    <button class="but">登录</button>
</body>

</html>
<script src="./common.js"></script>
<script>
    let ajax = new PublicUser()
    class Login{
        constructor({$,get,post}){
            this.$ = $
            this.get = get
            this.post = post
            this.init()//入口文件
        }
      init(){
          let thas = this
        this.$(".but").onclick = e =>{
            thas.get({
                url:"/login",
                text:{
                    user:thas.$("#user").value,
                    pass:thas.$("#pass").value
                },
                callback(str){
                    console.log(str);
                    if (str === "001") {
                        location.href= "http://localhost:3000/hom.html"                        
                    }

                }
            })
        }
      }
    }
    new Login(ajax)
</script>